<template>
  <div class="UserDeteil">
    <div class="parent">
      <span class="jj">{{name}}</span>
      <span class="jj">{{state}}</span>
      <span class="jj" @click="quit">退出登录</span>
    </div>
    <div class="parent"></div>
  </div>
</template>

<script type="text/ecmascript-6">
import axios from "@/util/http-service";
export default {
  name: "UserDeteil",
  data() {
    return {
      // 姓名
      name: "登录后获取",
      state: "",
      tlogin: "点击登录",

    };
  },
  inject: ["reload"],
  created: function() {
    this.getinformation();
    this.getuserwork();
  },
  methods: {
    setData(err, post) {
      if (err) {
        this.error = err.toString();
      } else {
        this.post = post;
      }
    },
    quit() {
      console.log("退出登录");
      localStorage.clear();
      this.reload();
    },
    getinformation() {
      //获取用户信息
      this.$http.userApi
        .information()
        .then(data => {
          let obj = data.data;
          this.name = obj.name;
        })
        .catch(err => {
          this.quit();
          // Message.Error("请求失败");
        });
    },
    getuserwork() {
      //获取用户审核状态
      this.$http.workApi
        .userwork({ workID: this.$route.query.id })
        .then(data => {
          let state = data.data.state;
          if(state!=""){
            this.state =state
          }
        })
        .catch(err => {
          // this.$message.Error("请求失败");
        });
    }
  },
  components: {}
};
</script>

<style scoped >
.parent {
  display: flex;
  justify-content: center; /*水平居中*/
  width: 100%;
  height: 100%;
}
.jj {
  display: flex;
  justify-content: center;
  margin: 2px;
}
</style>
